home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_com_simonov.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  153 lines

  1. # Jones 3D Cog Script
  2. #
  3. # com_Simonov.cog
  4. #
  5. # This COG controls the Simonov SKS Automatic Rifle for bad guys.
  6. #
  7. # [RandyT]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        fire
  16. message        aim
  17. message        activated
  18. message        deactivated
  19. message        selected
  20. message        deselected
  21.  
  22. sound        bang=gen_simonov_fire.wav    local    # Autoloaded
  23.  
  24. template    projectile=+simonov            local    # Autoloaded
  25. template    smoke1=+pistol_smoke1        local    # Autoloaded
  26. template    smoke2=+pistol_smoke2        local    # Autoloaded
  27.  
  28. thing        bandito                        local
  29. thing        bullet                        local
  30.  
  31. flex        aimFOV=25.0                    local
  32. flex        aimMax=5.0                    local
  33. flex        aimWait=0.3                    local
  34. flex        fireWait=0.47                local
  35.  
  36. int            numFires=0                    local
  37.  
  38. vector        firePos                        local
  39.  
  40. end
  41.  
  42. # ===================================================================
  43. code
  44.  
  45. # -------------------------------------------------------------------
  46. fire:
  47.  
  48.     bandito = GetSourceRef();
  49.  
  50.     # If he's done firing, deactivate the weapon
  51.     numFires = GetThingUserData(bandito);
  52.     if (numFires == 0)
  53.     {
  54.         DeactivateCurWeapon(bandito);
  55.         return;
  56.     }
  57.  
  58.     firePos = GetThingJointPos(bandito, GetNodeByName(bandito, "inrhand"));
  59.     bullet = FireProjectile(bandito, projectile, bang, 65, firePos, '0 0 0', 1.0, 0x220, aimFOV, aimMax);
  60.  
  61.     if (bullet == -1) return;
  62.  
  63.     if (Rand() < 0.5) CreateThing(smoke1, bullet);
  64.     else CreateThing(smoke2, bullet);
  65.     
  66.     SetFireWait(bandito, fireWait);
  67.  
  68.     # Set the number of shots left
  69.     numFires = numFires - 1;
  70.     SetThingUserData(bandito, numFires);
  71.  
  72.     return;
  73.  
  74.  
  75. # -------------------------------------------------------------------
  76. aim:
  77.  
  78.     bandito    = GetSourceRef();
  79.  
  80.     if ( IsModePlaying(bandito, 62) == 0 )                        # Weapon drawn?
  81.         return;
  82.  
  83.     if ( GetParam(0) )                                            # Got target?
  84.     {
  85.         if ( IsModePlaying(bandito, 63) == 0 )                    # Not aiming yet?
  86.         {
  87.             PlayMode(bandito, 63, 0);                            # Play "aiming" anim
  88.             SetAimWait(bandito, aimWait);
  89.         }
  90.     }
  91.     else
  92.     {
  93.         if ( IsModePlaying(bandito, 63) > 0 )                    # Currently aiming?
  94.         {
  95.             StopMode(bandito, 63, aimWait);                        # Stop aiming
  96.             PlayMode(bandito, 68, 0);                            # Play "stop aiming" anim
  97.             SetAimWait(bandito, aimWait);
  98.         }
  99.     }
  100.  
  101.     return;
  102.  
  103.  
  104. # -------------------------------------------------------------------
  105. activated:
  106.  
  107.     bandito = GetSourceRef();
  108.  
  109.     SetThingUserData(bandito, GetParam(0)); 
  110.     ActivateWeapon(bandito, aimWait);
  111.  
  112.     return;
  113.  
  114.  
  115. # -------------------------------------------------------------------
  116. deactivated:
  117.  
  118.     bandito = GetSourceRef();
  119.  
  120.     SetThingUserData(bandito, 0); 
  121.     DeactivateWeapon(bandito);
  122.  
  123. return;
  124.  
  125.  
  126. # -------------------------------------------------------------------
  127. selected:
  128.  
  129.     bandito = GetSourceRef();
  130.  
  131.     SetThingFireOffset(bandito, '0.0 0.05 0.005');
  132.     SetArmedMode(bandito, 3);
  133.     PlayMode(bandito, 62, 0);                                    # Play "draw weapon" anim
  134.  
  135.     return;
  136.  
  137.  
  138. # -------------------------------------------------------------------
  139. deselected:
  140.  
  141.     bandito = GetSourceRef();
  142.  
  143.     StopMode(bandito, 62, 0);                                    # Stop "draw weapon" anim
  144.     StopMode(bandito, 63, 0);                                    # Stop "aiming" anim
  145.  
  146.     SetArmedMode(bandito, 0);
  147.     SetThingFireOffset(bandito, '0 0 0');
  148.  
  149.     return;
  150.  
  151. end
  152.  
  153.